<template>
  <view class="order-confirm-bg">
    <!-- 顶部栏 -->
    <view class="order-header">
      <uni-icons type="left" size="24" @click="goBack" style="color: white;margin-right: 10px"/>
      <view class="order-title">确认订单</view>
    </view>

    <!-- 步骤条 -->
    <view class="order-steps">
      <view class="step" :class="{active: step >= 1}">预约服务</view>
      <view class="step-line" :class="{active: step >= 2}"></view>
      <view class="step" :class="{active: step >= 2}">支付订单</view>
      <view class="step-line" :class="{active: step >= 3}"></view>
      <view class="step" :class="{active: step >= 3}">门店服务</view>
    </view>

    <!-- 订单信息卡片 -->
    <view class="order-card">
      <view class="order-row">
        <uni-icons type="shop" size="20" style="color:#338aff; margin-right:8px"/>
        <view>
          <view class="order-shop">伟业汽车美容店（人民路店）</view>
          <view class="order-shop-addr">山阳区人民中路33号</view>
        </view>
      </view>
      <view class="order-row">
        <uni-icons type="person" size="20" style="color:#338aff; margin-right:8px"/>
        <view>张先生</view>
        <view class="order-phone">18656894566</view>
      </view>
      <view class="order-row">
        <uni-icons type="car" size="20" style="color:#338aff; margin-right:8px"/>
        <view>奔驰FWE4/豫A56487</view>
      </view>
    </view>

    <!-- 服务产品卡片 -->
    <view class="order-card">
      <view class="order-row order-row-between">
        <view>服务产品</view>
        <view class="order-product-count">共选择1项服务产品</view>
      </view>
      <view class="order-row order-row-between">
        <view>精洗汽车</view>
        <view class="order-price">￥39.9</view>
      </view>
    </view>

    <!-- 优惠券卡片 -->
    <view class="order-card">
      <view class="order-row order-row-between">
        <view>
          <uni-icons type="gift" size="20" style="color:#338aff; margin-right:8px"/>
          代金券/优惠券
        </view>
        <view class="order-coupon">-10元</view>
      </view>
    </view>

    <!-- 底部栏 -->
    <view class="order-bottom">
      <view class="order-bottom-left" @click="showPopup = true">
        <uni-icons type="staff-filled" size="22" style="margin-right: 4px"/>
        联系客服
      </view>
      <view class="order-bottom-center">
        合计：<text class="order-total">￥39.9</text>
      </view>
      <button class="order-submit" type="primary">提交订单</button>
    </view>

    <!-- 客服弹窗 -->
    <view v-if="showPopup" class="popup-mask" @click.self="showPopup = false">
      <view class="popup-content">
        <view class="popup-phone">18642589456</view>
        <button class="popup-btn" @click="copyPhone">复制</button>
        <button class="popup-btn cancel" @click="showPopup = false">取消拨号</button>
      </view>
    </view>
  </view>
</template>

<script setup>
import { ref } from 'vue';
const step = ref(2); // 当前步骤
const showPopup = ref(false);

function goBack() {
  uni.navigateBack();
}
function copyPhone() {
  uni.setClipboardData({
    data: '18642589456',
    success: () => {
      uni.showToast({ title: '已复制', icon: 'success' });
    }
  });
}
</script>


<style scoped lang="scss">
.order-confirm-bg {
  min-height: 100vh;
  background: #f5f6fa;
  padding-bottom: 80px;
}
.order-header {
  display: flex;
  align-items: center;
  height: 56px;
  background: #338aff;
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  padding: 0 16px;
}
.order-title {
  flex: 1;
  text-align: center;
  font-size: 20px;
  font-weight: bold;
}
.order-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0 8px 0;
}
.step {
  font-size: 14px;
  color: #bbb;
  padding: 0 8px;
}
.step.active {
  color: #338aff;
  font-weight: bold;
}
.step-line {
  width: 32px;
  height: 2px;
  background: #eee;
  margin: 0 2px;
  border-radius: 1px;
}
.step-line.active {
  background: #338aff;
}
.order-card {
  background: #fff;
  border-radius: 12px;
  margin: 12px 16px 0 16px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(51,138,255,0.04);
  font-size: 15px;
}
.order-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  color: #333;
}
.order-row:last-child {
  margin-bottom: 0;
}
.order-row-between {
  justify-content: space-between;
}
.order-shop {
  font-weight: bold;
  color: #222;
}
.order-shop-addr {
  font-size: 12px;
  color: #888;
}
.order-phone {
  margin-left: auto;
  color: #888;
  font-size: 14px;
}
.order-product-count {
  color: #888;
  font-size: 13px;
}
.order-price {
  color: #ff4d4f;
  font-weight: bold;
}
.order-coupon {
  color: #ff4d4f;
  font-weight: bold;
}
.order-bottom {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  box-shadow: 0 -2px 8px rgba(51,138,255,0.04);
  padding: 0 12px;
  z-index: 10;
}
.order-bottom-left {
  display: flex;
  align-items: center;
  color: #338aff;
  font-size: 15px;
}
.order-bottom-center {
  flex: 1;
  text-align: right;
  color: #333;
  font-size: 15px;
  margin-right: 12px;
}
.order-total {
  color: #ff4d4f;
  font-size: 18px;
  font-weight: bold;
}
.order-submit {
  width: 100px;
  height: 38px;
  border-radius: 20px;
  font-size: 15px;
  margin-left: 8px;
}
.popup-mask {
  position: fixed;
  left: 0; right: 0; bottom: 0; top: 0;
  background: rgba(0,0,0,0.3);
  display: flex;
  align-items: flex-end;
  z-index: 999;
}
.popup-content {
  width: 100%;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 24px 0 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.popup-phone {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 16px;
}
.popup-btn {
  width: 80%;
  margin: 8px 0;
  padding: 12px 0;
  border-radius: 8px;
  background: #338aff;
  color: #fff;
  font-size: 16px;
  border: none;
}
.popup-btn.cancel {
  background: #eee;
  color: #333;
}
</style>
